package vip.xiaonuo.controller.deviceapi.vo;

import java.util.LinkedHashMap;

public class ReturnJson {

  private String code;
  private String msg;
  private LinkedHashMap<String, Object> data = new LinkedHashMap<>();

  public void put(String key, Object value) {
    data.put(key, value);
  }

  public void remove(String key) {
    data.remove(key);
  }

  public String getCode() {
    return code;
  }

  public void setCode(String code) {
    this.code = code;
  }

  public LinkedHashMap<String, Object> getData() {
    return data;
  }

  public void setData(LinkedHashMap<String, Object> data) {
    this.data = data;
  }

  public String getMsg() {
    return msg;
  }

  public void setMsg(String msg) {
    this.msg = msg;
  }

  public void setData(String key, Object value) {
    this.data.put(key, value);
  }

  public void success(String key, Object value) {
    this.code = "200";
    this.msg = "success";
    this.setData(key, value);
  }


  public void failed(String key, Object value) {
    this.code = "500";
    this.msg = "filed";
    this.setData(key, value);
  }
}
